package com.wjc.lib.io

import com.wjc.lib.StandFun
import java.io.FileInputStream
import java.io.FileOutputStream
import java.io.OutputStream

/**
 * ClassName: com.wjc.lib.io
 * Description:
 * JcChen on 2022.02.16.23:15
 */
object IOTest {

    @JvmStatic
    fun main(args: Array<String>) {
        io2()


    }

    private fun io1() {
        var outputStream: FileOutputStream? = null
        try {
            outputStream = FileOutputStream("./lib/text.txt")  // 二进制
            outputStream.write(3)
            outputStream.write(1)

        } catch (e: Exception) {
            e.printStackTrace()
        } finally {
            try {
                outputStream?.close()
            } catch (e: Exception) {

            }
        }

    }

    private fun io2() {
        var outputStream: FileInputStream? = null
        try {
            outputStream = FileInputStream("./lib/text.txt")  // 二进制
            println(outputStream.read())
            print(outputStream.read())
        } catch (e: Exception) {
            e.printStackTrace()
        } finally {
            try {
                outputStream?.close()
            } catch (e: Exception) {

            }
        }

    }
}